﻿using System;
using System.Collections.Generic;
using System.Net;
using System.Text;

namespace DeZhen.Core.Framework.Http
{
    public class HttpResult
    {
        private HttpResult(Object data)
        {
            Data = data;
        }
        private HttpResult()
        {

        }
        public HttpStatusCode Code { get; set; } = HttpStatusCode.OK;
        public String Message { get; set; } = String.Empty;
        public Object Data { get; set; }
        public Boolean IsSuccess { get; set; } = true;

        public static HttpResult Success(Object data)
        {
            return new HttpResult(data);
        }
        public static HttpResult Success(String message,Object data)
        {
            return new HttpResult() { Message = message,Data = data};
        }
        public static HttpResult Error(String message, Object data = null, HttpStatusCode code = HttpStatusCode.InternalServerError)
        {
            return new HttpResult() { Message = message, Data = data, Code = code, IsSuccess = false };
        }
    }
}
